package com.springcloud.client3tcc.web.controller;

import com.codingapi.txlcn.tc.annotation.DTXPropagation;
import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.codingapi.txlcn.tc.annotation.TccTransaction;
import com.codingapi.txlcn.tracing.TracingContext;
import com.springcloud.client3tcc.web.entity.User;
import com.springcloud.client3tcc.web.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author liq
 * @Title: UserController
 * @ProjectName lcn-demo
 * @Description: TODO
 * @date 2019-06-0409:08
 */
@RequestMapping("/user")
@RestController
@Slf4j
public class UserController {


    @Autowired
    private UserService userService;


    @GetMapping("/insert")
    public String insert(User user){
        String res ="success";
        user.setGroupId(TracingContext.tracing().groupId());
        userService.insert(user);
        return res;
    }


}
